struct pair_hash{
    template<typename T1, typename T2>
    std::size_t operator () (const pair<T1, T2> & p) const {
        return (size_t)p.first * 13131 + p.second;
    }
};